<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="author" content="">
    <title></title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("../inc/list_css.html"){}%>
    <style>
        .btn-primary{
            background-color: #15baff !important;
        }
    </style>
</head>

<body>
<div class="ibox ">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title">
            <span>财务管理 </span>
            <span class="line">/</span>
            佣金明细
        </div>
    </div>
    <div class="ibox-content">
        <div class="wrapper wrapper-content">
            <input type="hidden" name="memberLevel" id="memberLevel" value="1">
            <div class="row">
                <div class="col-sm-12" >
                    <div class="alert alert-warning alert-dismissable">
                        <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                        订单分成比例：<label class="orderPercent"></label> &nbsp;
                        <!--当日营业额：<label class="totalAmount"></label> &nbsp;分红比例：<label class="rewardPercent"></label> &nbsp;分红人数：<label class="rewardNum"></label> &nbsp;分红金额：<label class="rewardCash"></label>-->
                    </div>
                    <div class="btn-group margin-top-20">

                        <button class="reward btn statistic_btn hive-btn-primary " type="button" data="1" style="border-radius: 4px 0px 0px 4px;">一钻经理</button>
                        <button class="reward statistic_btn" type="button" data="2" style="border-radius: 0px 0px 0px 0px;border-right: 0px;margin-left: -5px">二钻经理</button>
                        <button class="reward statistic_btn" type="button" data="3" style="border-radius: 0px 0px 0px 0px;border-right: 0px;margin-left: -5px">三钻经理</button>
                        <button class="reward statistic_btn" type="button" data="4" style="border-radius: 0px 0px 0px 0px;border-right: 0px;margin-left: -5px">银钻董事</button>
                        <button class="reward statistic_btn" type="button" data="5" style="border-radius: 0px 0px 0px 0px;border-right: 0px;margin-left: -5px">金钻董事</button>
                        <button class="reward statistic_btn" type="button" data="6" style="border-radius: 0px 0px 0px 0px;border-right: 0px;margin-left: -6px">一通董事</button>
                    </div>

                    <!--<div id="toolbar">
                        <div class="form-inline" role="form">
                            <button type="button" class="btn btn-warning" onclick="exportprofit()">导出</button>
                        </div>
                    </div>-->
                    <table id="cpTableEvents" data-toggle="table" data-mobile-responsive="true" class=" table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                        <thead class="table-header">
                        <tr>
                            <th data-field="number" data-formatter="numberFormatter">序号</th>
                            <th data-field="code">会员ID</th>
                            <th data-field="username">会员昵称</th>
                            <th data-field="phone">联系方式</th>
                            <th data-field="totalIncome">总收入</th>
                            <th data-field="profit">订单分红金额</th>
                            <th data-field="status" data-formatter="boolFormatter">分红状态</th>
                            <th data-field="createDate">日期</th>
                            <!--<th data-field="distribution" data-formatter="opFormatter"><a href="javascript:void(0)" onclick="distribution();" style="color: red">[一键分配]</a></th>-->
                        </tr>
                        </thead>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>


<% include("../inc/list_js.html"){}%>
<script src="/res/plugins/laydate/laydate.js"></script>

<script>
    function exportprofit(){
        var profitDate=$("#start").val();
        var memberLevel=$("#memberLevel").val();
        location.href = 'exportfdjt?profitDate='+profitDate+'&memberLevel='+memberLevel+'';

    }
    function look(){
        var profitDate=$("#start").val();//生成分红日期
        var memberLevel=$("#memberLevel").val();
        if(!profitDate){
            layer.msg("请选择日期!");
            return;
        }
        $('#cpTableEvents').bootstrapTable("refresh",{query: {type:memberLevel,profitDate:profitDate}});
    }
    function numberFormatter(value, row, index){
        return index+1;
    }
    function opFormatter(value, row, index){
        var html='';
        if(row.status){
            html+='<a href="javascript:void(0)" );>[已分配]</a>';
        }else{
            //html+='<a href="javascript:void(0)" onclick="distribution(\''+row.id+'\');" style="color: red">[点击分配]</a>';
            html+='<a href="javascript:void(0)" style="color: red">[未分配]</a>';
        }
        return html;
    }
    function boolFormatter(v) {
        if(v)
            return '已分红';
        else
            return '未分红';
    }

    (function() {
        $('.reward').on('click',function (e) {
            $('.reward').removeClass('hive-btn-primary');
            $(this).addClass('hive-btn-primary');

            /*$('.reward').removeClass('btn-primary').addClass('btn-white');
            $(this).removeClass('btn-white').addClass('btn-primary');*/

            $('#cpTableEvents').bootstrapTable("refresh",{query: {type: $(this).attr('data'),profitDate:$("#start").val()}});
            $("#memberLevel").attr("value",$(this).attr('data'))
        });

        $('#cpTableEvents').bootstrapTable({
            url: "ajaxFdjtList",
            dataType: 'json',
            contentType: 'application/json',
            search: true,
            searchAlign: 'right',
            pagination: true,
            showRefresh: true,
            pageSize: 20,
            showToggle: false,//是否显示card/table切换按钮
            showColumns: true,//是否显示内容列下拉框
            pageList: [20, 50, 100],
            iconSize: 'outline',
            toolbar: '#eventsToolbar',
            paginationHAlign: 'right', //right, left
            paginationVAlign: 'bottom',
            icons: {
                refresh: 'icon-refresh',
                toggle: 'glyphicon-list-alt',
                columns: 'icon-select',
                export: 'icon-export'
            },
            responseHandler: function (res) {
                $("#dsh").html(res.length);
                return res;
            },
            formatNoMatches: function () { //判断有无数据
                var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';
                return imghtml;
            },
            formatLoadingMessage: function () {  //数据加载中样式
                return ' <div id="loading"><div id="loading-center">' +
                    '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                    '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                    '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
            },
        });


    })();

</script>
<script>
    var start = {
        elem: '#start',
        format: 'YYYY-MM-DD hh:mm:ss',
        //min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        //istime: true,
        istoday: false,
    };
    laydate(start);

</script>
</body>

</html>